import request from '@/api/request'
import g from "@/utils/utilFn";
export function getlist(param) {

    let data = new FormData()
    return request({
        url: '/right_module/getlist',
        method: 'POST',
        data
    })
}
export function remove_by_id(id) {
    let data = new FormData()
    data.append("id", id || "");
    return request({
        url: '/right_module/delete_by_id',
        method: 'POST',
        data
    })
}

export function update(param) {
    param = g.objEngraving({
        id: "",
        pguid: "",
        module_name: "",
        url: "",
        state: 1
    }, param || {})
    let data = new FormData()
    Object.keys(param).map((key) => {
        data.append(key, param[key] || "");
    });
    return request({
        url: '/right_module/update',
        method: 'POST',
        data
    })
}
export function add(param) {
    param = g.objEngraving({
        guid: "",
        pguid: "",
        module_name: "",
        url: "",
        state: 1
    }, param || {})
    let data = new FormData()
    Object.keys(param).map((key) => {
        data.append(key, param[key] || "");
    });
    return request({
        url: '/right_module/add',
        method: 'POST',
        data
    })
}

export const stateOptions = [
    { key: '0', name: '不可用' },
    { key: '1', name: '正常' },
    { key: '2', name: '隐藏' }
]